From de000558b55970cf1d6ef93bbbe10b412f4d0a63 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Sat, 22 Apr 2006 17:05:57 +0000 Subject: [PATCH] Check shortname length before read. --- gpsbabel/lowranceusr.c | 3 ++- gpsbabel/tpg.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gpsbabel/lowranceusr.c b/gpsbabel/lowranceusr.c index 1b96fe4b8..7e4f2a70d 100644 --- a/gpsbabel/lowranceusr.c +++ b/gpsbabel/lowranceusr.c @@ -338,7 +338,8 @@ lowranceusr_parse_waypt(waypoint *wpt_tmp) } lowranceusr_fread(&buff[0], 4, 1, file_in); TextLen = buff[0]; - lowranceusr_fread(&buff[0], TextLen, 1, file_in); + if (TextLen) + lowranceusr_fread(&buff[0], TextLen, 1, file_in); buff[TextLen] = '\0'; wpt_tmp->shortname = xstrdup(buff); diff --git a/gpsbabel/tpg.c b/gpsbabel/tpg.c index 8cb11f5f3..391706290 100644 --- a/gpsbabel/tpg.c +++ b/gpsbabel/tpg.c @@ -161,9 +161,10 @@ tpg_read(void) stringsize = buff[0]; - tpg_fread(&buff[0], stringsize, 1, tpg_file_in); - - buff[stringsize] = '\0'; + if (stringsize) + tpg_fread(&buff[0], stringsize, 1, tpg_file_in); + + buff[stringsize] = '\0'; wpt_tmp->shortname = xstrdup(buff); -- 2.30.2